//
//  PictureView.m
//  Project two framework
//
//  Created by rimi on 16/7/29.
//  Copyright © 2016年 张峥. All rights reserved.
//

#import "PictureView.h"



@implementation PictureView

+ (instancetype)showOtherView
{
    static PictureView *pictureView = nil;
    pictureView = [[PictureView alloc]init];
    return pictureView;
}

- (instancetype)init
{
    self = [super init];
    if (self) {
        [self addOtherView];
    }
    return self;
}

- (void)addOtherView
{
    [super addOtherView];
    [self.imageView addSubview:self.topLine];
    [self.imageView addSubview:self.bottomLine];
    [self.imageView addSubview:self.pictureImage];
    [self.imageView addSubview:self.condition];
    [self.imageView addSubview:self.circulation];
    [self.imageView addSubview:self.suppliers];
    [self.imageView addSubview:self.size];
    [self.imageView addSubview:self.category];
    [self.imageView addSubview:self.suitable];
}
- (UIView *)topLine
{
    if (_topLine == nil) {
        _topLine = ({
            UIView *view = [[UIView alloc]initWithFrame:CGRectMake(50, CGRectGetMaxY(self.nameLabel.bounds) + 50, CGRectGetMaxX(self.imageView.bounds) - 100, 1)];
            view.backgroundColor = [UIColor grayColor];
            view;
        });
    }
    return _topLine;
}

- (UIView *)bottomLine
{
    if (_bottomLine == nil) {
        _bottomLine = ({
            UIView *view = [[UIView alloc]initWithFrame:CGRectMake(50, 450, CGRectGetMaxX(self.imageView.bounds) - 100, 1)];
            view.backgroundColor = [UIColor grayColor];
            view;
        });
    }
    return _bottomLine;
}

- (UIImageView *)pictureImage
{
    if (_pictureImage == nil) {
        _pictureImage = ({
            UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectMake(CGRectGetWidth(self.imageView.bounds) / 2 - 135, CGRectGetMaxY(self.topLine.frame) + 20, 270, 110)];
            imageView;
        });
    }
    return _pictureImage;
}

- (UILabel *)condition
{
    if (_condition == nil) {
        _condition = ({
            UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMinX(self.pictureImage.frame) - 200 , CGRectGetMaxY(self.pictureImage.frame) + 50, 300, 40)];
            label.textAlignment = NSTextAlignmentLeft;
            label.font = [UIFont systemFontOfSize:16];
            label;
        });
    }
    return _condition;
}

-(UILabel *)circulation
{
    if (_circulation == nil) {
        _circulation = ({
            UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMinX(self.condition.frame)  , CGRectGetMaxY(self.condition.frame), 300, 40)];
            label.textAlignment = NSTextAlignmentLeft;
            label.font = [UIFont systemFontOfSize:16];
            label;
        });
    }
    return _circulation;
}

-(UILabel *)suppliers
{
    if (_suppliers == nil) {
        _suppliers = ({
            UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMinX(self.circulation.frame)  , CGRectGetMaxY(self.circulation.frame), 300, 40)];
            label.textAlignment = NSTextAlignmentLeft;
            label.font = [UIFont systemFontOfSize:16];
            label;
        });
    }
    return _suppliers;
}

-(UILabel *)size
{
    if (_size == nil) {
        _size = ({
            UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMinX(self.pictureImage.frame) - 40 + 300 , CGRectGetMaxY(self.pictureImage.frame) + 50, 300, 40)];            label.textAlignment = NSTextAlignmentLeft;
            label.font = [UIFont systemFontOfSize:16];
            label;
        });
    }
    return _size;
}

-(UILabel *)category
{
    if (_category == nil) {
        _category = ({
            UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMinX(self.size.frame)  , CGRectGetMaxY(self.size.frame), 300, 40)];
            label.textAlignment = NSTextAlignmentLeft;
            label.font = [UIFont systemFontOfSize:16];
            label;
        });
    }
    return _category;
}

-(UILabel *)suitable
{
    if (_suitable == nil) {
        _suitable = ({
            UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMinX(self.category.frame)  , CGRectGetMaxY(self.category.frame), 300, 40)];
            label.textAlignment = NSTextAlignmentLeft;
            label.font = [UIFont systemFontOfSize:16];
            label;
        });
    }
    return _suitable;
}

@end
